@extends('admin.layouts._menu')
@section('content')
    <form action="{{route('admin.role.permission',$role)}}" method="post">
        @csrf
        <h4 class="text-secondary">编辑 [{{$role['title']}}] 角色权限</h4>
        @foreach($modules as $module)
            @if($module['permission'])
                <div class="card small text-dark">
                    <div class="card-header">
                        {{$module['name']}}
                    </div>
                    <div class="card-body">
                        <div class="row">
                            @foreach($module['permission'] as $permission)
                                <div class="col-4 mb-2">
                                    @if($role->hasPermissionTo($permission['name']))
                                        <input type="checkbox" name="permissions[]" checked value="{{$permission['name']}}">
                                    @else
                                        <input type="checkbox" name="permissions[]"  value="{{$permission['name']}}">
                                    @endif
                                    {{$permission['title']}} ({{$permission['name']}})
                                </div>
                            @endforeach
                        </div>
                    </div>
                </div>
            @endif
        @endforeach
        <button class="btn btn-primary btn-sm">保存提交</button>
    </form>
@endsection
